<template>
    <div class="doneList">
        <div class="title">
            <h2>已完成</h2>
            <span class="doneCount">{{ doneTotal }}</span>
        </div>
        <ul class="list"></ul>
    </div>
</template>

<script>
export default {
    name: "UserFooter",
    props: ["todos"],
    computed: {
        doneTotal() {
            //使用reduce方法做条件统计
            //简写
            return this.todos.reduce((pre, todo) => pre + (todo.done ? 1 : 0), 0)
        },
    }
}
</script>

<style lang="scss" scoped>
.doneList {
    width: 600px;
    margin: 0 auto;
    display: flex;
}

.title {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.title span {
    padding: 0 5px;
    height: 20px;
    border-radius: 20px;
    background: #e6e6fa;
    line-height: 22px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.list a {
    width: 12px;
    height: 12px;
    border-radius: 12px;
    border: 6px double #fff;
    margin-right: 10px;
    background: #ccc;
    line-height: 14px;
    text-align: center;
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
}
</style>